﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Licenta1;

namespace Licenta1.Expressions
{
    [Serializable]
    class IdentifierExpression : Expression
    {
        String name;

        public IdentifierExpression(Context con, String name)
            : base(con)
        {
            this.name = name;
            //Console.WriteLine("Apelat IdentifierExpression cu " + name);
        }

        public override object Value
        {
            get
            {
                if (context.variables.ContainsKey(name))
                    return context.variables[name];
                else
                {
                    return null;
                }
            }
        }

        public string Name
        {
            get { return name; }
        }
    }
}